#include "AS5048A.h"
#include "main.h"
#include "spi.h"
#define Angle 0xFFFF

float ReadAS5048Angle(AS5048A_Struct * pAS5048A)
{
	float angle;
	uint16_t angleValue;
  uint16_t command = Angle;
	pAS5048A->SetCSLeave(0);
	pAS5048A->SPIWriteRead(&command,&angleValue);
	pAS5048A->SetCSLeave(1);
	angle = (float)(angleValue & 0x3FFF) * 360 /16383;
	angle = angle - pAS5048A->angleOffect;
	if (angle < 0) 
		{
			angle = angle + 360.0f;
		}
    return  angle;
}

